package com.luoxiang.lib_common.adapter

import android.graphics.Color
import android.widget.TextView
import androidx.core.content.ContextCompat
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.luoxiang.lib_common.R
import com.luoxiang.lib_common.bean.EvaluationLabel

class EvaluateLabelAdapter(data: MutableList<EvaluationLabel>) :
    BaseQuickAdapter<EvaluationLabel, BaseViewHolder>(
        R.layout.item_evaluate, data
    ) {
    var indexItemData: HashMap<Int, EvaluationLabel> = hashMapOf()
    override fun convert(holder: BaseViewHolder, item: EvaluationLabel) {
        holder.apply {
            getView<TextView>(R.id.textEvaluateLabel).apply {
                text = item.name
                if (indexItemData.containsKey(item.id)) {
                    background = ContextCompat.getDrawable(context,R.drawable.bg_item_evaluate_type1)
                    setTextColor(Color.parseColor("#835DFF"))
                }else{
                    background = ContextCompat.getDrawable(context,R.drawable.bg_item_evaluate_type2)
                    setTextColor(Color.parseColor("#FFFFFF"))
                }
            }
        }
    }
}